package com.apimarket.controller;


import com.apimarket.entity.SysMenu;
import com.apimarket.service.SysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.apimarket.entity.vo.JsonResult;

import javax.xml.rpc.ServiceException;

@RequestMapping("/menu/")
@RestController
public class SysMenuController {
    @Autowired
    SysMenuService sysMenuService;

    @RequestMapping("doFindObjects")
    public JsonResult doFindObjects(Integer page,Integer pageSize) throws ServiceException {
        return new  JsonResult(sysMenuService.findObjects(page,pageSize)
        );
    }

    @RequestMapping("doDeleteObject")
    public JsonResult doDeleteObjects(Integer id) throws ServiceException {
        sysMenuService.deleteObject(id);
        return new  JsonResult("delete ok");
    }

    @RequestMapping("doFindZtreeMenuNodes")
    public JsonResult doFindZtreeMenuNodes(){
        return new JsonResult(
                sysMenuService.findZtreeMenuNodes());
    }

    @RequestMapping("doSaveObject")
    public JsonResult doSaveObject(SysMenu entity){
        sysMenuService.saveObject(entity);
        return new JsonResult("save ok");
    }

    @RequestMapping("doUpdateObject")
    public JsonResult doUpdateObject(
            SysMenu entity) throws ServiceException {
        sysMenuService.updateObject(entity);
        return new JsonResult("update ok");
    }





}
